package com.zhuangfei.timetable.listener;

import com.zhuangfei.timetable.model.Schedule;

import ohos.agp.components.StackLayout;
import ohos.agp.components.Text;
import ohos.agp.components.element.ShapeElement;

/**
 * Item构建监听器的默认实现.
 */
public class OnItemBuildAdapter implements ISchedule.OnItemBuildListener {
    @Override
    public String getItemText(Schedule schedule, boolean isThisWeek) {
        if (schedule == null || schedule.getName().equals("")) {
            return "未命名";
        }
        if (schedule.getRoom() == null) {
            if (!isThisWeek) {
                return "[非本周]" + schedule.getName();
            }
            return schedule.getName();
        }
        String res = schedule.getName() + "@" + schedule.getRoom();
        if (!isThisWeek) {
            res = "[非本周]" + res;
        }

        return res;

    }

    @Override
    public void onItemUpdate(StackLayout layout, Text textView, Text countTextView,Schedule schedule, ShapeElement gd) {
    }
}
